package com.example.driptip.model;

public class Alarm {
    private String id;
    private String name;
    private String type;
    private boolean isRunning;
    private boolean isRepeating;
    
    // 对于固定时间闹钟
    private Integer duration;
    
    // 对于自定义时间闹钟
    private Integer hours;
    private Integer minutes;
    private Integer seconds;
    
    private long startTime;
    private long remainingTime;
    
    // Getters and Setters
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public boolean isRunning() {
        return isRunning;
    }

    public void setRunning(boolean running) {
        isRunning = running;
        if (running) {
            this.startTime = System.currentTimeMillis();
            // 计算总时长（毫秒）
            if ("custom".equals(type)) {
                this.remainingTime = ((hours * 3600L) + (minutes * 60L) + seconds) * 1000L;
            } else {
                this.remainingTime = duration * 1000L;
            }
        } else {
            this.startTime = 0;
            this.remainingTime = 0;
        }
    }

    public boolean isRepeating() {
        return isRepeating;
    }

    public void setRepeating(boolean repeating) {
        isRepeating = repeating;
    }

    public Integer getDuration() {
        return duration;
    }

    public void setDuration(Integer duration) {
        this.duration = duration;
    }

    public Integer getHours() {
        return hours;
    }

    public void setHours(Integer hours) {
        this.hours = hours;
    }

    public Integer getMinutes() {
        return minutes;
    }

    public void setMinutes(Integer minutes) {
        this.minutes = minutes;
    }

    public Integer getSeconds() {
        return seconds;
    }

    public void setSeconds(Integer seconds) {
        this.seconds = seconds;
    }

    public long getStartTime() {
        return startTime;
    }

    public long getRemainingTime() {
        return remainingTime;
    }

    public void updateRemainingTime(long newRemainingTime) {
        this.remainingTime = newRemainingTime;
    }
} 